package com.fz.study.project.controller;


import com.fz.study.project.entity.AdminUser;
import com.fz.study.project.entity.dto.LoginDto;
import com.fz.study.project.entity.Result;
import com.fz.study.project.service.IAdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "登陆")
@RestController
@RequiredArgsConstructor
@RequestMapping("/login")
public class AdminLogin {

    private final IAdminUserService adminUserService;

    @Operation(summary = "登陆")
    @PostMapping
    public Result loginByName(@RequestBody LoginDto loginDto){
        return adminUserService.loginByName(loginDto);
    }

    @Operation(summary = "修改密码")
    @PutMapping("password")
    public Result uploadWithPassword(@RequestBody AdminUser adminUser){
        adminUserService.updateWithPassword(adminUser);
        return Result.success("修改密码成功！！");

    }
}
